package ch.usi.inf.pf2.analyzer;
import junit.framework.TestCase;
import ch.usi.inf.pf2.analyzer.Token;
import ch.usi.inf.pf2.analyzer.TokenType;

/**
 * 
 * @author Thomas Mantegazzi
 * @date 22 april 2010
 *
 */





public class TestToken extends TestCase {
	
	private Token token1;
	
	protected void setUp()
    {
		token1 = new Token("+",2,TokenType.PLUS);
	}
	
	public void testGetText() {
		String text = token1.getText();
		assertEquals("+", text);
	}
	
	public void testGetType() {
		assertEquals(TokenType.PLUS, token1.getType());
	}
	
	public void testGetStartPosition() {
		assertEquals(2,token1.getStartPosition());
	}
	
	public void testSetText() {
		token1.setText("ciao");
		assertEquals("ciao", token1.getText());
	}
	
	public void testSetStartPosition() {
		token1.setStartPosition(3);
		assertEquals(3,token1.getStartPosition());
	}
	
	public void testSetType() {
		token1.setType(TokenType.SLASH);
		assertEquals(TokenType.SLASH,token1.getType());
	}
	

}
